package com.ict.web.constant;

import com.ict.web.vo.ApproveProgressVo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * 项目枚举状态
 */
public enum ProjectStatusEnum {

    /**
     * 项目申报
     */
    STATEMENT_NOT_SUBMITTED(new ApproveProgressVo("-1", "申报提交", "项目申报", "待提交")),
    DECLARATION_SUBMISSION_SUBMITTED(new ApproveProgressVo("0", "申报提交", "项目申报", "已提交")),
    APPLICATION_REVIEW_TO_BE_REVIEWED(new ApproveProgressVo("1", "申报审核", "项目申报", "待审核")),

    /**
     * 申报审核
     */
    APPLICATION_REVIEW_PASSED(new ApproveProgressVo("2","申报审核","项目申报","已通过")),
    APPLICATION_REVIEW_RETURN_MODIFICATION(new ApproveProgressVo("3","申报审核","项目申报","退回修改")),
    APPLICATION_REVIEW_REJECT(new ApproveProgressVo("4","申报审核","项目申报","驳回")),

    /**
     * 方案申报
     */
    SCHEME_DECLARATION_TO_BE_SUBMITTED(new ApproveProgressVo("5","方案申报","方案申报","待提交")),
    SCHEME_DECLARATION_SUBMISSION_SUBMITTED(new ApproveProgressVo("6","方案申报","方案申报","已提交")),


    /**
     * 安排评审会议
     */
    ARRANGE_REVIEW_MEETING_TO_BE_EXTRACTED(new ApproveProgressVo("7","安排评审会议","方案申报","待抽取专家")),
    ARRANGE_REVIEW_TO_BE_ACCEPTED(new ApproveProgressVo("8","安排评审会议","方案申报","已抽取专家")),
    ARRANGE_REVIEW_TO_BE_REBACK(new ApproveProgressVo("69","安排评审会议","方案申报","退回重申")),
    /**
     * 接受任务
     */
    ACCEPT_NOT_TASK(new ApproveProgressVo("9","接受任务","方案申报","待接受任务")),
    ACCEPT_TASKED(new ApproveProgressVo("10","接受任务","方案申报","已接受任务")),

    /**
     * 在线预审
     */
    ONLINE_PREQUALIFICATION_PENDING_APPROVAL(new ApproveProgressVo("11","在线预审","方案申报","待审批")),
    ONLINE_PREQUALIFICATION_APPROVED(new ApproveProgressVo("12","在线预审","方案申报","已审批")),

    /**
     * 意见汇总
     */
    COMMENTS_SUMMARY_TO_BE_APPROVED(new ApproveProgressVo("13","意见汇总","方案申报","待审批")),
    OPINION_SUMMARY_APPROVED(new ApproveProgressVo("14","意见汇总","方案申报","通过")),
    SUMMARY_AND_RETURN_OF_COMMENTS(new ApproveProgressVo("15","意见汇总","方案申报","退回重申")),

    /**
     * 现场论证
     */
    ON_SITE_DEMONSTRATION_TO_BE_REVIEWED(new ApproveProgressVo("16","现场论证","方案申报","待审核")),
    THE_ONSITE_DEMONSTRATION_HAS_BEEN_PASSED(new ApproveProgressVo("17","现场论证","方案申报","已通过")),
    ON_SITE_DEMONSTRATION_NEEDS_TO_BE_MODIFIED(new ApproveProgressVo("18","现场论证","方案申报","通过需要修改")),
    ON_SITE_DEMONSTRATION_RETURN_RESTATEMENT(new ApproveProgressVo("19","现场论证","方案申报","退回重申")),

    /**
     * 三方审批
     */
     THIRD_PARTY_APPROVAL_TO_BE_REVIEWED(new ApproveProgressVo("20","三方审批","方案申报","待三方审批")),
     THIRD_PARTY_APPROVAL_APPROVED(new ApproveProgressVo("21","三方审批","方案申报","三方已审批")),

    /**
     * 三方论证审核
     */
    REVIEW_OF_THIRD_PARTY_APPROVAL_RESULTS_TO_BE_REVIEWED(new ApproveProgressVo("22","三方论证审核","方案申报","待审核")),
    REVIEW_OF_THIRD_PARTY_APPROVAL_RESULTS_HAS_BEEN_PASSED(new ApproveProgressVo("23","三方论证审核","方案申报","已通过")),
    REVIEW_OF_THIRD_PARTY_APPROVAL_RESULTS_RETURN_RESTATEMENT(new ApproveProgressVo("24","三方论证审核","方案申报","退回重审")),

    /**
     * 初设及概算方案批复
     */
    FINANCIAL_APPROVAL_AND_FILING_TO_BE_REVIEWED(new ApproveProgressVo("25","初设及概算方案批复","方案申报","待提交")),
    FINANCIAL_APPROVAL_AND_FILING_HAS_BEEN_PASSED(new ApproveProgressVo("26","初设及概算方案批复","方案申报","已提交")),
    FINANCIAL_APPROVAL_AND_FILING_RETURN_RESTATEMENT(new ApproveProgressVo("27","初设及概算方案批复","方案申报","退回重审")),

    /**
     * 合同备案
     */
     CONTRACT_FILING_TO_BE_SUBMITTED(new ApproveProgressVo("28","合同备案","项目实施","待提交")),
     CONTRACT_FILING_SUBMITTED(new ApproveProgressVo("29","合同备案","项目实施","已提交")),

    /**
     * 里程碑管理
     */
     MILESTONE_MANAGEMENT_TO_BE_SUBMITTED(new ApproveProgressVo("30","里程碑管理","项目实施","待提交")),
     MILESTONE_MANAGEMENT_SUBMITTED(new ApproveProgressVo("31","里程碑管理","项目实施","已提交")),




    /**
     * 合规审查
     */
     COMPLIANCE_REVIEW_TO_BE_SUBMITTED(new ApproveProgressVo("32","合规审查","项目验收","待提交")),
     COMPLIANCE_REVIEW_SUBMITTED(new ApproveProgressVo("33","合规审查","项目验收","已提交")),
     COMPLIANCE_REVIEW_TO_BE_REVIEWED(new ApproveProgressVo("34","合规审查","项目验收","待审核")),
     COMPLIANCE_REVIEW_HAS_BEEN_PASSED(new ApproveProgressVo("35","合规审查","项目验收","已通过")),
     COMPLIANCE_REVIEW_REJECTED(new ApproveProgressVo("36","合规审查","项目验收","已驳回")),

    /**
     * 初验备案
     */
    PRELIMINARY_INSPECTION_AND_FILING_TO_BE_SUBMITTED(new ApproveProgressVo("37","初验备案","项目验收","待提交")),
    PRELIMINARY_INSPECTION_AND_FILING_SUBMITTED(new ApproveProgressVo("38","初验备案","项目验收","已提交")),
    /**
     * 终验备案
     */
     FINAL_ACCEPTANCE_RECORD_TO_BE_SUBMITTED(new ApproveProgressVo("39","终验备案","项目验收","待提交")),
     FINAL_ACCEPTANCE_RECORD_SUBMITTED(new ApproveProgressVo("40","终验备案","项目验收","已提交")),


    /**
     * 绩效考评
     */
    PERFORMANCE_EVALUATION_TO_BE_EVALUATED(new ApproveProgressVo("41","绩效考评","项目验收","待考评")),
    PERFORMANCE_EVALUATION_HAS_BEEN_EVALUATED(new ApproveProgressVo("42","绩效考评","项目验收","已考评")),


    /**
     * 年度项目计划状态
     */
    ANNUAL_PROJECT_PLAN_NOT_STARTED(new ApproveProgressVo("43","年度项目计划状态","","未启动")),
    ANNUAL_PROJECT_PLAN_REPORTING(new ApproveProgressVo("44","年度项目计划状态","","正在申报")),
    ANNUAL_PROJECT_PLAN_PAUSED(new ApproveProgressVo("45","年度项目计划状态","","已暂停")),
    ANNUAL_PROJECT_PLAN_TO_BE_REVIEWED(new ApproveProgressVo("46","年度项目计划状态","","待审核")),
    ANNUAL_PROJECT_PLAN_APPROVED(new ApproveProgressVo("47","年度项目计划状态","","已审核")),

    /**
     * 转派任务
     */
    TURN_SENT_TASK(new ApproveProgressVo("48","转派任务","方案申报","已转派")),

    /**
     * 三方预审审核
     */
    BIG_DATA_AUDIT_COMMENTS_SUMMARY_TO_BE_APPROVED(new ApproveProgressVo("49","三方预审审核","方案申报","待审批")),
    BIG_DATA_AUDIT_OPINION_SUMMARY_APPROVED(new ApproveProgressVo("50","三方预审审核","方案申报","通过")),
    BIG_DATA_AUDIT_SUMMARY_AND_RETURN_OF_COMMENTS(new ApproveProgressVo("51","三方预审审核","方案申报","退回重审")),
    /**
     * 申报修改
     */
    APPLICATION_UPDATE_TO_BE_SUBMITTED(new ApproveProgressVo("52","申报修改","项目申报","待提交")),
    APPLICATION_UPDATE_TO_BE_APPROVED(new ApproveProgressVo("53","申报修改","项目申报","待审批")),
    APPLICATION_UPDATE_PASSED(new ApproveProgressVo("54","申报修改","项目申报","通过")),
    APPLICATION_UPDATE_RETURN_MODIFICATION(new ApproveProgressVo("55","申报修改","项目申报","退回修改")),
    APPLICATION_UPDATE_TURN_DOWN(new ApproveProgressVo("68","申报修改","项目申报","驳回")),

    /**
     * 方案修改
     */
    SCHEME_DECLARATION_UPDATE_TO_BE_SUBMITTED(new ApproveProgressVo("56","方案修改","方案申报","待提交")),
    SCHEME_DECLARATION_UPDATE_TO_BE_APPROVED(new ApproveProgressVo("57","方案修改","方案申报","待审批")),
    SCHEME_DECLARATION_UPDATE_PASSED(new ApproveProgressVo("58","方案修改","方案申报","通过")),
    SCHEME_DECLARATION_UPDATE_RETURN_MODIFICATION(new ApproveProgressVo("59","方案修改","方案申报","通过需修改")),

    /**
     * 在线预审
     */
    ONLINE_PREQUALIFICATION_PENDING_ARRANGE(new ApproveProgressVo("60","在线预审","方案申报","待安排评审会议")),

    /**
     * 重新预审
     */
    ONLINE_PREQUALIFICATION_PENDING_APPROVAL_AGAIN(new ApproveProgressVo("11","重新预审","方案申报","待审批")),
    ONLINE_PREQUALIFICATION_APPROVED_AGAIN(new ApproveProgressVo("12","重新预审","方案申报","已审批")),

    /**
     * 申请取消
     */
    APPROVAL_CANCEL_APPROVAL_AGAIN(new ApproveProgressVo("61","申请取消","方案申报","待审核")),
    APPROVAL_CANCEL_APPROVED_AGAIN_YES(new ApproveProgressVo("62","申请取消","方案申报","同意取消")),
    APPROVAL_CANCEL_APPROVED_AGAIN_NO(new ApproveProgressVo("63","申请取消","方案申报","不同意取消")),
    /**
     * 申请取消
     */
    ON_SITE_DEMONSTRATION_lAPPLY_CANCEL(new ApproveProgressVo("64","申请取消","方案申报","申请取消")),

    /**
     * 方案预审
     */
    PROGRAM_PREREVIEW_PENDING(new ApproveProgressVo("65","方案预审","方案申报","待审核")),
    PROGRAM_PREREVIEW_PASS(new ApproveProgressVo("66","方案预审","方案申报","通过")),
    PROGRAM_PREREVIEW_RETURN_FOR_RETRIAL(new ApproveProgressVo("67","方案预审","方案申报","退回重申"));


    /**
     * 项目流程状态
     */
    private final ApproveProgressVo approveProgressVo;

    ProjectStatusEnum(ApproveProgressVo approveProgressVo) {
        this.approveProgressVo = approveProgressVo;
    }

    public ApproveProgressVo get() {
        return approveProgressVo;
    }
    public static ApproveProgressVo getEnum(String  status){
        Optional<ProjectStatusEnum> any = Arrays.stream(ProjectStatusEnum.class.getEnumConstants())
                .filter(e -> e.get().getStatus().equals(status)).findAny();
        if (any.isPresent()){
            return any.get().get();
        }
        return null;
    }
    public static List<String> getEnumByStatusDes(String  StatusDes){
        List<String> arrayList = new ArrayList<>();
        List<ProjectStatusEnum> projectStatusEnumList = Arrays.stream(ProjectStatusEnum.class.getEnumConstants())
                .filter(e -> e.get().getStatusDes().equals(StatusDes)).collect(Collectors.toList());
        projectStatusEnumList.stream().forEach(s->{
            arrayList.add(s.get().getStatus());
        });
        return arrayList;
    }
    public static List<String> getEnumByStage(String  stage){
        List<String> arrayList = new ArrayList<>();
        List<ProjectStatusEnum> projectStatusEnumList = Arrays.stream(ProjectStatusEnum.class.getEnumConstants())
                .filter(e -> e.get().getStage().equals(stage)).collect(Collectors.toList());
        projectStatusEnumList.stream().forEach(s->{
            arrayList.add(s.get().getStatus());
        });
        return arrayList;
    }

    public static List<String> getEnumByNode(String  node){
        List<String> arrayList = new ArrayList<>();
        List<ProjectStatusEnum> projectStatusEnumList = Arrays.stream(ProjectStatusEnum.class.getEnumConstants())
                .filter(e -> e.get().getNode().equals(node)).collect(Collectors.toList());
        projectStatusEnumList.stream().forEach(s->{
            arrayList.add(s.get().getStatus());
        });
        return arrayList;
    }
}
